<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('社工提现列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>社工名称：</label>
                                <input type="text" name="wName"/>
                            </li>

                            <li>
                                <label>状态:</label>
                                <select name="status">
                                    <option value="">所有</option>
                                    <option value="0">审核中</option>
                                    <option value="1">成功</option>
                                    <option value="2">驳回</option>
                                </select>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="jiajia:workerTiXian:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="jiajia:workerTiXian:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="jiajia:workerTiXian:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
<!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="jiajia:workerTiXian:export">-->
<!--                    <i class="fa fa-download"></i> 导出-->
<!--                </a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('jiajia:workerTiXian:edit')}]];
        var removeFlag = [[${@permission.hasPermi('jiajia:workerTiXian:remove')}]];
        var prefix = ctx + "jiajia/workerTiXian";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "社工提现",
                sortName: "addtime",
                sortOrder: "desc",
                columns: [
                {
                    field: 'wName',
                    title: '社工名称',
                    formatter:function (value, row, index) {
                        var actions = [];
                        actions.push($.table.imageView(row.wAvatar,500,500))
                        actions.push("&nbsp&nbsp"+row.wName)
                        return actions.join('');
                    }
                },
                {
                    field: 'money',
                    title: '提现金额',
                    formatter:function (value, row, index) {
                        var actions = [];
                        actions.push(row.money.toFixed(2)+"元")
                        return actions.join('');
                    }
                },
                {
                    field: '银行信息',
                    title: '银行信息',
                    formatter:function (value, row, index) {
                        var actions = [];
                        var bankInfo = JSON.parse(row.bankInfo)
                        actions.push("银行:"+bankInfo.banrName)
                        actions.push("</br>");
                        actions.push("银行卡号:"+bankInfo.code)
                        return actions.join('');
                    }
                },
                {
                    field: 'status',
                    title: '状态:',
                    formatter:function (value, row, index) {
                        var actions = [];
                        if (row.status == 0) {
                            actions.push('<i class="fa fa-edit" style="color: goldenrod">待审核</i>');
                        } else if (row.status == 1) {
                            actions.push('<i class="fa fa-edit" style="color:#11bf79">成功</i>');
                        } else actions.push('<i class="fa fa-edit" style="color: red">驳回</i>');
                        return actions.join('');
                    }
                },
                {
                    field: 'cause',
                    title: '驳回原因'
                },
                {
                    field: 'stime',
                    title: '审核时间',
                    formatter:function (value, row, index) {
                        var actions = [];
                        actions.push("申请时间:"+row.addtime)
                        actions.push("</br>")
                        actions.push("审核时间:"+row.stime)
                        return actions.join('');
                    }
                },
                {
                    title: '审核',
                    align: 'status',
                    formatter: function (value, row, index) {
                        var actions = [];
                        if (row.status == 0) {
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="onTongGuoClick(\'' + row.id + '\')"><i class="fa fa-check-square-o"></i>通过</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="unTongGuoClick(\'' + row.id + '\')"><i class="fa fa-remove"></i>驳回</a>');
                        }
                        return actions.join('');
                    }

                },
                ]
            };
            $.table.init(options);
        });

        function onTongGuoClick(id) {
            var data = {
                "id": id,
                "status": 1,
                "cause": ""
            }
            $.modal.confirm("确认通过吗?", function () {
                $.operate.submit(prefix + "/shenHeTiXian", "post", "json", data, function (res) {

                });
            });
        }

        function unTongGuoClick(id) {
            layer.prompt({title: '请说明未通过原因，并确认', formType: 2}, function (text, index) {
                layer.close(index);
                var data = {
                    "id": id,
                    "status": 2,
                    "cause": text
                }
                $.operate.submit(prefix + "/shenHeTiXian", "post", "json", data, function (res) {

                });
            });
        }
    </script>
</body>
</html>